package phase01module02.homework;

public class SurfClass extends Abstract implements SurfInterface{

    /**
     * expense 资费
     * quantity 数量
     */
    Bill bill = new Bill();

    public SurfClass() {
    }

    public SurfClass(int expense, int quantity/*, Bill bill*/) {
        super(expense, quantity);
//        this.bill = bill;
    }

    //重写抽象方法，且打印继承下来的抽象方法中成员 及自身成员
    @Override
    public void show() {
        System.out.println("上网套餐：国内流量日租" + getExpense() + "元/GB，赠送国内流量" + getQuantity() + "GB");
    }

    //重写接口中的抽象方法、把流量、资费、对象传回bill.countSurfFlow方法中
    //重写上网流量接口（使用）
    @Override
    public void surfPackage(int surfFlow, PhoneCard phoneCard) {
        if(0 == getExpense()){
            setExpense(1);
        }
        bill.countSurfFlow(surfFlow, getExpense(), phoneCard);
    }
}
